﻿
$(function () {
    var tab = document.getElementById("first");
    if (tab == undefined || tab == null) return;
    var divs = tab.getElementsByTagName("div");
    if (divs == undefined || divs == null) return;
    var responseContent;
    for (var i = 0; i < divs.length; i++) {
        divs[i].onclick = function () {
            if (this.className == "on") {
                return false;
            } else {
                //得到状态为on的tab
                var status = getStatus(divs);
                var lang = this.lang;
                this.className = "on";
                document.getElementById(lang).className = "show";
                document.getElementById(status).className = "hide";
                return true;
            }
        }
    }
}
);

//找到状态为on的那个tab 将状态设置为off
function getStatus(divs) {
    var tabId;
    for (var i = 0; i < divs.length; i = i + 1) {
        if (divs[i].className == 'on') {
            divs[i].className = "off";
            tabId = divs[i].lang;
            break;
        } else {
            continue;
        }
    }
    return tabId;
}
